package LatentTicTacToe.Data;

import java.io.Serializable;

/**
 * Class containing information needed to perform move
 * 
 * @author Jiri Cermak
 *
 */
public class Move implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	/**
	 * x coordinate of move
	 */
	public byte x;
	
	/**
	 * y coordinate of move
	 */
	public byte y;
	
	public Move(Move move) {
		this.x = move.x;
		this.y = move.y;
	}
	
	public Move(byte x, byte y) {
		this.x = x;
		this.y = y;
	}


	
	@Override
	public int hashCode() {
		
		final int prime = 31;
		int result = 1;
		
		result = prime * result + x;
		result = prime * result + y;
		
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		
		Move other = (Move) obj;
		
		if (x != other.x)
			return false;
		if (y != other.y)
			return false;
		
		return true;
	}

	@Override
	public String toString() {
		return "" + this.x + this.y;
	}
}
